//导入request.js请求工具
import request from '@/utils/request.js'

// 获取签到列表（未结束的签到）
export const getSigns = (params) => {
    return request({
        url: '/admins/signs/getSigns',
        method: 'get',
        params
    })
}

// 获取已结束的签到列表
export const getEndedSigns = (params) => {
    return request({
        url: '/admins/signs/getEndedSigns',
        method: 'get',
        params
    })
}

// 导出签到数据
export const exportSigns = (params) => {
    return request({
        url: '/admins/signs/exportEndedSigns',
        method: 'get',
        params,
        responseType: 'blob'
    })
}

// 获取签到详情
export const getSignDetail = (mid) => {
    return request({
        url: `/admins/signs/getSignDetail/${mid}`,
        method: 'get'
    })
}

// 获取参与者列表
export const getParticipants = (params) => {
    return request({
        url: '/admins/signs/getParticipants',
        method: 'get',
        params
    })
}

// 添加签到
export const addSign = (data) => {
    return request({
        url: '/admins/signs/addSign',
        method: 'post',
        data
    })
}

// 更新签到
export const updateSign = (data) => {
    return request({
        url: '/admins/signs/updateSign',
        method: 'put',
        data
    })
}

// 删除签到
export const deleteSign = (mid) => {
    return request({
        url: `/admins/signs/deleteSign/${mid}`,
        method: 'delete'
    })
}
